home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
WINPROGS
/
UPC12BS1.ZIP
/
UUCICO
/
DCP.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-03
|
26KB
|
767 lines
/*--------------------------------------------------------------------*/
/* d c p . c */
/* */
/* Main routines for UUCICO */
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/* Changes Copyright (c) 1989-1993 by Kendra Electronic */
/* Wonderworks. */
/* */
/* All rights reserved except those explicitly granted by the */
/* UUPC/extended license agreement. */
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/* Copyright (c) Richard H. Lamb 1985, 1986, 1987 */
/* Changes Copyright (c) Stuart Lynne 1987 */
/*--------------------------------------------------------------------*/
/*
* $Id: dcp.c 1.20 1993/10/03 20:37:34 ahd Exp $
*
* $Log: dcp.c $
* Revision 1.20 1993/10/03 20:37:34 ahd
* Don't attempt to suspend port if using network protocol suite
*
* Revision 1.19 1993/09/30 03:06:28 ahd
* Move suspend signal handler into suspend2
*
* Revision 1.18 1993/09/29 13:18:06 ahd
* Don't call suspend handler under DOS Turbo C++ (not impletemented, anyway)
*
* Revision 1.17 1993/09/29 04:52:03 ahd
* Suspend port by port name, not modem file name
*
* Revision 1.16 1993/09/27 00:48:43 ahd
* Control UUCICO in passive mode by K. Rommel
*
* Revision 1.15 1993/09/20 04:46:34 ahd
* OS/2 2.x support (BC++ 1.0 support)
* TCP/IP support from Dave Watt
* 't' protocol support
*
* Revision 1.14 1993/08/02 03:24:59 ahd
* Further changes in support of Robert Denny's Windows 3.x support
*
* Revision 1.13 1993/07/31 16:26:01 ahd
* Changes in support of Robert Denny's Windows support
*
* Revision 1.12 1993/07/22 23:22:27 ahd
* First pass at changes for Robert Denny's Windows 3.1 support
*
* Revision 1.11 1993/05/30 00:01:47 ahd
* Allow tracing connection via UUCICO -t flag
*
* Revision 1.10 1993/04/11 00:35:46 ahd
* Global edits for year, TEXT, etc.
*
* Revision 1.9 1993/04/05 04:32:19 ahd
* Allow unique send and receive packet sizes
*
* Revision 1.8 1993/01/23 19:08:09 ahd
* Don't update host status at sysend() if hostp is not initialized
*
* Revision 1.7 1992/12/18 12:05:57 ahd
* Suppress duplicate machine state messages to improve OS/2 scrolling
*
* Revision 1.6 1992/12/01 04:37:03 ahd
* Add standard comment block for header
*
* Revision 1.5 1992/11/28 19:51:16 ahd
* If in multitask mode, only open syslog on demand basis
*
* Revision 1.4 1992/11/22 21:30:55 ahd
* Do not bother to strdup() string arguments
*
* 25Aug87 - Added a version number - Jal
* 25Aug87 - Return 0 if contact made with host, or 5 otherwise.
* 04Sep87 - Bug causing premature sysend() fixed. - Randall Jessup
* 13May89 - Add date to version message - Drew Derbyshire
* 17May89 - Add '-u' (until) option for login processing
* 01 Oct 89 Add missing function prototypes
* 28 Nov 89 Add parse of incoming user id for From record
* 18 Mar 90 Change checktime() calls to Microsoft C 5.1
*/
/*--------------------------------------------------------------------*/
/* This program implements a uucico type file transfer and remote */
/* execution protocol. */
/* */
/* Usage: UUCICO [-s sys] */
/* [-r 0|1] */
/* [-x debug] */
/* [-d hhmm] */
/* [-m modem] */
/* [-l logfile] */
/* [-x debuglevel] */
/* [-w userid] */
/* [-z bps] */
/* [-t] */
/* */
/* e.g. */
/* */
/* UUCICO [-x n] -r 0 [-d hhmm] client mode, wait for an incoming */
/* call for 'hhmm'. */
/* UUCICO [-x n] -s HOST call the host "HOST". */
/* UUCICO [-x n] -s all call all known hosts in the systems */
/* file. */
/* UUCICO [-x n] -s any call any host we have work queued for. */
/* UUCICO [-x n] same as the above. */
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/* System include files */
/*--------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <limits.h>
#include <time.h>
#ifdef _Windows
#include <Windows.h>
#endif
/*--------------------------------------------------------------------*/
/* UUPC/extended prototypes */
/*--------------------------------------------------------------------*/
#include "lib.h"
#include "arpadate.h"
#include "catcher.h"
#include "checktim.h"
#include "dcp.h"
#include "dcplib.h"
#include "dcpstats.h"
#include "dcpsys.h"
#include "dcpxfer.h"
#include "expath.h"
#include "getopt.h"
#include "hlib.h"
#include "hostable.h"
#include "hostatus.h"
#include "lock.h"
#include "logger.h"
#include "modem.h"
#include "security.h"
#include "ssleep.h"
#include "suspend.h"
#include "commlib.h"
#if defined(_Windows)
#include "winutil.h"
#endif
/*--------------------------------------------------------------------*/
/* Define passive and active polling modes; passive is */
/* sometimes refered to as "slave", "active" as master. Since */
/* the roles can actually switch during processing, we avoid */
/* the terms here */
/*--------------------------------------------------------------------*/
typedef enum {
POLL_PASSIVE = 0, /* We answer the telephone */
POLL_ACTIVE = 1 /* We call out to another host */
} POLL_MODE ;
/*--------------------------------------------------------------------*/
/* Global variables */
/*--------------------------------------------------------------------*/
size_t s_pktsize; /* send packet size for protocol */
size_t r_pktsize; /* receive packet size for protocol */
FILE *xfer_stream = NULL; /* stream for file being handled */
boolean callnow = FALSE; /* TRUE = ignore time in L.SYS */
FILE *fwork = NULL, *fsys= NULL ;
FILE *syslog = NULL;
char workfile[FILENAME_MAX]; /* name of current workfile */
char *Rmtname = nil(char); /* system we want to call */
char rmtname[20]; /* system we end up talking to */
struct HostTable *hostp;
struct HostStats remote_stats; /* host status, as defined by hostatus */
static boolean dialed = FALSE;/* True = We attempted a phone call */
currentfile();
/*-----------------